package com.punch.order.config;

import com.punch.order.service.TimeTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 启动的时候初始化定时任务
 */
@Component
@Slf4j
public class TimeTaskConfig implements ApplicationRunner {

    @Resource
    private TimeTaskService taskService;

    @Override
    public void run(ApplicationArguments applicationArguments) {
        log.info("========初始化定时任务==========");
        taskService.initCron();
    }
}
